﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using caedisi.Web.DataModel;
using System.ComponentModel;

namespace caedisi.Views.Controls
{
    /// <summary>
    /// the window that shows when right-clicking a cell
    /// </summary>
    public partial class VertexProperties : ChildWindow, INotifyPropertyChanged
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="VertexProperties"/> class.
        /// </summary>
        public VertexProperties()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="VertexProperties"/> class.
        /// </summary>
        /// <param name="cell">The cell.</param>
        public VertexProperties(Cell cell)
        {
            InitializeComponent();
            this.CurrentCell = cell;
        }


        private Cell _CurrentCell;
        /// <summary>
        /// Gets or sets the current cell.
        /// </summary>
        /// <value>
        /// The current cell.
        /// </value>
        public Cell CurrentCell
        {
            get
            {
                    return _CurrentCell;
            }
            set
            {
                if (_CurrentCell != value)
                {
                    _CurrentCell = value;
                    this.RaisePropertyChanged("CurrentCell");
                }
            }
        }

        /// <summary>
        /// Handles the Click event of the OKButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// Raises the property changed.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        protected virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
       
    }
}

